<template>
  <div class="app-container">
    <Header></Header>
    <main class="main-container">
      <div class="knowledge-container">
        <div class="page-header">
          <h1>知识库管理</h1>
          <p>管理和维护系统知识库内容</p>
        </div>
        
        <div class="actions-bar">
          <div class="search-box">
            <input 
              type="text" 
              placeholder="搜索知识库..." 
              class="search-input"
            >
            <button class="search-btn">🔍</button>
          </div>
          <button class="btn btn-primary">
            <span>+</span> 上传文档
          </button>
        </div>
        
        <div class="content-grid">
          <div class="panel-card">
            <div class="panel-header">
              <h3 class="panel-title">文档列表</h3>
              <div class="panel-actions">
                <select class="filter-select">
                  <option>全部类型</option>
                  <option>PDF</option>
                  <option>Word</option>
                  <option>Excel</option>
                </select>
              </div>
            </div>
            <div class="documents-list">
              <div class="document-item">
                <div class="document-info">
                  <div class="document-icon">📄</div>
                  <div class="document-details">
                    <h4>工商银行2023年财报.pdf</h4>
                    <div class="document-meta">
                      <span class="meta-item">1.2MB</span>
                      <span class="meta-item">2023-04-15</span>
                      <span class="meta-item status-success">已索引</span>
                    </div>
                  </div>
                </div>
                <div class="document-actions">
                  <button class="action-btn">👁️</button>
                  <button class="action-btn">✏️</button>
                  <button class="action-btn">🗑️</button>
                </div>
              </div>
              
              <div class="document-item">
                <div class="document-info">
                  <div class="document-icon">📊</div>
                  <div class="document-details">
                    <h4>A股市场分析报告.docx</h4>
                    <div class="document-meta">
                      <span class="meta-item">856KB</span>
                      <span class="meta-item">2023-04-10</span>
                      <span class="meta-item status-success">已索引</span>
                    </div>
                  </div>
                </div>
                <div class="document-actions">
                  <button class="action-btn">👁️</button>
                  <button class="action-btn">✏️</button>
                  <button class="action-btn">🗑️</button>
                </div>
              </div>
              
              <div class="document-item">
                <div class="document-info">
                  <div class="document-icon">📑</div>
                  <div class="document-details">
                    <h4>金融行业政策汇编.pdf</h4>
                    <div class="document-meta">
                      <span class="meta-item">2.1MB</span>
                      <span class="meta-item">2023-04-05</span>
                      <span class="meta-item status-processing">索引中</span>
                    </div>
                  </div>
                </div>
                <div class="document-actions">
                  <button class="action-btn">👁️</button>
                  <button class="action-btn">✏️</button>
                  <button class="action-btn">🗑️</button>
                </div>
              </div>
              
              <div class="document-item">
                <div class="document-info">
                  <div class="document-icon">📰</div>
                  <div class="document-details">
                    <h4>宏观经济季度报告.xlsx</h4>
                    <div class="document-meta">
                      <span class="meta-item">3.4MB</span>
                      <span class="meta-item">2023-03-28</span>
                      <span class="meta-item status-success">已索引</span>
                    </div>
                  </div>
                </div>
                <div class="document-actions">
                  <button class="action-btn">👁️</button>
                  <button class="action-btn">✏️</button>
                  <button class="action-btn">🗑️</button>
                </div>
              </div>
            </div>
          </div>
          
          <div class="panel-card">
            <div class="panel-header">
              <h3 class="panel-title">统计信息</h3>
            </div>
            <div class="stats-grid">
              <div class="stat-card">
                <div class="stat-value">24</div>
                <div class="stat-label">总文档数</div>
              </div>
              <div class="stat-card">
                <div class="stat-value">22</div>
                <div class="stat-label">已索引</div>
              </div>
              <div class="stat-card">
                <div class="stat-value">2</div>
                <div class="stat-label">处理中</div>
              </div>
              <div class="stat-card">
                <div class="stat-value">1.8GB</div>
                <div class="stat-label">总大小</div>
              </div>
            </div>
            
            <div class="panel-section">
              <h4>最近活动</h4>
              <div class="activity-list">
                <div class="activity-item">
                  <div class="activity-icon">Uploader</div>
                  <div class="activity-content">
                    <div class="activity-text">上传了"工商银行2023年财报.pdf"</div>
                    <div class="activity-time">2小时前</div>
                  </div>
                </div>
                
                <div class="activity-item">
                  <div class="activity-icon">🔄</div>
                  <div class="activity-content">
                    <div class="activity-text">完成"金融行业政策汇编.pdf"索引</div>
                    <div class="activity-time">5小时前</div>
                  </div>
                </div>
                
                <div class="activity-item">
                  <div class="activity-icon">🗑️</div>
                  <div class="activity-content">
                    <div class="activity-text">删除了"过期数据表.xlsx"</div>
                    <div class="activity-time">1天前</div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </main>
  </div>
</template>

<script>
import Header from './Header.vue'
export default {
  name: 'KnowledgeManagement',
  components: {
    Header
  }
};
</script>

<style scoped>
.app-container {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
}

.main-container {
  flex: 1;
  padding: 20px;
  background-color: #f5f7fa;
}

.knowledge-container {
  max-width: 1200px;
  margin: 0 auto;
}

.page-header {
  margin-bottom: 30px;
}

.page-header h1 {
  font-size: 2rem;
  color: #2c3e50;
  margin: 0 0 10px 0;
}

.page-header p {
  color: #6c757d;
  margin: 0;
}

.actions-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  gap: 20px;
}

.search-box {
  display: flex;
  flex: 1;
  max-width: 400px;
}

.search-input {
  flex: 1;
  padding: 12px 15px;
  border: 1px solid #e1e5e9;
  border-radius: 8px 0 0 8px;
  font-size: 1rem;
  outline: none;
}

.search-input:focus {
  border-color: #4A90E2;
}

.search-btn {
  padding: 12px 20px;
  border: 1px solid #e1e5e9;
  border-left: none;
  border-radius: 0 8px 8px 0;
  background: #f8f9fa;
  cursor: pointer;
  transition: background 0.3s ease;
}

.search-btn:hover {
  background: #e9ecef;
}

.btn {
  padding: 12px 20px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  font-weight: 500;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn-primary {
  background: #1976d2;
  color: white;
}

.btn-primary:hover {
  background: #1565c0;
}

.content-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
}

.panel-card {
  background: white;
  border-radius: 10px;
  padding: 25px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
}

.panel-title {
  font-size: 1.3rem;
  color: #2c3e50;
  margin: 0;
}

.panel-actions {
  display: flex;
  gap: 10px;
}

.filter-select {
  padding: 8px 12px;
  border: 1px solid #e1e5e9;
  border-radius: 6px;
  background: white;
  font-size: 0.9rem;
}

.documents-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.document-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px;
  border-radius: 8px;
  border: 1px solid #e1e5e9;
  transition: all 0.3s ease;
}

.document-item:hover {
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.08);
  border-color: #dee2e6;
}

.document-info {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 1;
}

.document-icon {
  font-size: 2rem;
}

.document-details h4 {
  margin: 0 0 8px 0;
  color: #2c3e50;
}

.document-meta {
  display: flex;
  gap: 15px;
}

.meta-item {
  font-size: 0.85rem;
  color: #6c757d;
}

.status-success {
  color: #27AE60;
  font-weight: 500;
}

.status-processing {
  color: #F1C40F;
  font-weight: 500;
}

.document-actions {
  display: flex;
  gap: 10px;
}

.action-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1px solid #e1e5e9;
  background: white;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
}

.action-btn:hover {
  background: #f8f9fa;
  transform: translateY(-2px);
}

.stats-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px;
  margin-bottom: 30px;
}

.stat-card {
  text-align: center;
  padding: 20px;
  border-radius: 8px;
  background: #f8f9fa;
}

.stat-value {
  font-size: 1.8rem;
  font-weight: bold;
  color: #1976d2;
  margin-bottom: 5px;
}

.stat-label {
  color: #6c757d;
  font-size: 0.9rem;
}

.panel-section {
  border-top: 1px solid #e1e5e9;
  padding-top: 20px;
}

.panel-section h4 {
  margin: 0 0 15px 0;
  color: #2c3e50;
}

.activity-list {
  display: flex;
  flex-direction: column;
  gap: 15px;
}

.activity-item {
  display: flex;
  gap: 15px;
}

.activity-icon {
  font-size: 1.2rem;
  align-self: flex-start;
}

.activity-content {
  flex: 1;
}

.activity-text {
  margin-bottom: 5px;
  color: #2c3e50;
}

.activity-time {
  font-size: 0.85rem;
  color: #6c757d;
}

@media (max-width: 768px) {
  .actions-bar {
    flex-direction: column;
    align-items: stretch;
  }
  
  .search-box {
    max-width: none;
  }
  
  .content-grid {
    grid-template-columns: 1fr;
  }
  
  .stats-grid {
    grid-template-columns: 1fr 1fr;
  }
  
  .document-item {
    flex-direction: column;
    align-items: flex-start;
    gap: 15px;
  }
  
  .document-actions {
    align-self: flex-end;
  }
  
  .document-meta {
    flex-wrap: wrap;
  }
}
</style>